Skip to content

fix(pm-stack): handle symlinked usage-export entry points - #5184

Merged
dezren39 merged 1 commit into
mainfrom
queue/8765-5099-usage-export-realpath
Nov 8, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/8765-5099-usage-export-realpath

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

-if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
+if (isMain) // compare fs.realpathSync paths

Adds regression coverage for direct, file-symlink, directory-symlink execution and inert library imports. Closes #5099.

Evidence

  • Before: direct invocation exited 3 and wrote store-missing; file and directory symlinks exited 0 silently with no output document.
  • After: node --test pm-stack/opencode-usage-export/opencode-usage-export.test.mjs — 6 passed, 0 failed. The repo-wide raw argv-path guard grep is clean.

Merge Danger

Door: two-way

Blast Radius: low

Only the OpenCode usage exporter entry-point detection and its tests change; rollback is a small code revert.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 22:13
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29800bbe-f4a4-42f1-853a-c28aeab7452c
Commits

Reviewing files that changed from the base of the PR and between e425b6a and ef3ed8c.

Files selected for processing: 2
  • pm-stack/opencode-usage-export/opencode-usage-export.mjs
  • pm-stack/opencode-usage-export/opencode-usage-export.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T22:17:45.521113Z ef3ed8c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

CI coverage note: fresh gh pr checks reports only CodeRabbit as skipped; gh run list --branch queue/8765-5099-usage-export-realpath has no workflow runs. The documented policy (.github/ci-policy.md §2/§3.3) describes a basic PR tier and class-2 affected-package tests, but .github/workflows/nix-ci.yml currently declares only push-to-main, schedule, and workflow_dispatch triggers; pm-stack-tests.yml and pm-aggregator-tests.yml are also push-to-main/dispatch only. Local targeted tests pass, but there is no PR CI result to treat as green. Leaving this PR open pending appropriate checks/review; this appears to be a pre-existing CI trigger/coverage gap, not introduced by this change.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef3ed8c1b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
assert.equal(result.status, 0, result.stderr);
assert.equal(result.stdout, "");
assert.equal(result.stderr, "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow SQLite experimental warnings in the import test

On supported Node 22 releases, importing node:sqlite emits an ExperimentalWarning to stderr even when the exporter correctly skips its main routine. Since the exporter imports DatabaseSync unconditionally, this assertion makes the new library-import test fail with default warning settings on a runtime explicitly supported by the README. Suppress that known warning in the child process or distinguish it from exporter output rather than requiring stderr to be completely empty.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant